package com.viajero.movil;

import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle.Control;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.TextView;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;
import com.google.android.maps.Projection;

public class RutaGuardadaActivity extends MapActivity {

	
	MapView mapa;
	MapController mapaControl;

	final CharSequence[] items = {"Tipo de local","Productos"};
	final CharSequence[] items1 = {"Farmacia","Ferreteria","Panaderia","Boutique","Zapateria"};
	final CharSequence[] items2 = {"Polos","zapatos","Arroz"};
	
    Dialog filtro;
    TextView etiqueta;
    Spinner spLista;
    Button btnAceptar;
	
	@Override
	protected void onCreate(Bundle arg0) {
		// TODO Auto-generated method stub
		super.onCreate(arg0);
		setContentView(R.layout.ruta_guardada);
		initMapView();
		initMyLocation();
		
		//Drawable drawable = getResources().getDrawable(R.drawable.indiana_jones);

	}

	private void initMyLocation() {
		// TODO Auto-generated method stub
		
		final MyLocationOverlay overlay = new MyLocationOverlay(this, mapa );
		overlay.enableMyLocation();
		overlay.enableCompass();
		overlay.runOnFirstFix(new Runnable() {
			
			@Override
			public void run() {
				// TODO Auto-generated method stub
				mapaControl.setZoom(16);
				mapaControl.animateTo(overlay.getMyLocation());
			}
		});
		mapa.getOverlays().add(overlay);
		
		seleccionarFiltro();
	}


    public void seleccionarFiltro(){
    	filtro = new Dialog(this,R.style.DialgoPantallaCompleta);
    	filtro.setContentView(R.layout.busqueda_filtro1);
    	
    	etiqueta = (TextView)filtro.findViewById(R.id.etiqueta);
    	
    	spLista = (Spinner)filtro.findViewById(R.id.spLista);
    	ArrayAdapter<CharSequence> adaptador = new ArrayAdapter<CharSequence>(this,android.R.layout.simple_spinner_item, items);
		adaptador.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spLista.setAdapter(adaptador);
    	
    	btnAceptar = (Button)filtro.findViewById(R.id.btnAceptar);
    	btnAceptar.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				filtro.cancel();
				
				
			}
		});
    	
    	filtro.show();
    }
    
	
	private void initMapView() {
		// TODO Auto-generated method stub
		mapa = (MapView)findViewById(R.id.mapview);
		mapaControl =mapa.getController();
		mapa.setClickable(true);
		mapa.setSatellite(false);
		mapa.setBuiltInZoomControls(true);
		
	}

	@Override
	protected boolean isRouteDisplayed() {
		// TODO Auto-generated method stub
		return false;
	}

	


}
